import type { ButtonProps } from 'antd';
import { Button, Tooltip } from 'antd';
import React from 'react';

export const TooltipBtn: React.FC<Props> = (props) => {
  const {
    disabled = false,
    title = '',
    onClick,
    type = 'link',
    style = {},
  } = props;

  return (
    <Tooltip title={title}>
      <Button type={type} disabled={disabled} onClick={onClick} style={style}>
        {props.children}
      </Button>
    </Tooltip>
  );
};

type buttonType = Pick<ButtonProps, 'type'>['type'];
interface Props {
  children: string;
  disabled?: boolean;
  title?: string;
  onClick?: () => void;
  type?: buttonType;
  style?: Record<string, any>;
}
